# 对小数部分进行顺序按位输出，求小数部分的每一位之和
# 方案一
# num = float(input("请输入任意小数"))
# num = num - num // 1
# sum = 0
# while num != num // 1:
#     num *= 10
#     a = int(num) % 10
#     sum += a
#     print(a,end='')
# print(f"和为：{sum}")


# 方案二
# num = float(input("请输入任意小数:"))
# num = num - int(num)
# sum = 0
# while num > 0:
#     a = num * 10
#     b = int(a)
#     print(b,end='')
#     sum += b
#     num = a - b
# print("")
# print(sum)


# 将1234.567的全部数字顺序输出：1 2 3 4 5 6 7，并计算和为：28
# 方案一：连续地将数字除以10，直到变成一个纯粹的小数，即0.XXX，然后按照上面的方案一解决
# num = float(input("请输入任意小数"))
# while int(num) >= 1:
#     num /=10
# sum = 0
# while num != int(num):
#     num *= 10
#     a = int(num) % 10
#     sum += a
#     print(a,end='')
# print(f"和为：{sum}")

# 方案二：连续地将该数字乘以10，直到变成纯粹的整数
num = float(input("请输入任意小数"))
sum = 0
while num != int(num):
    num *= 10
a = num
count = 0
while int(a) >= 1:
    a /= 10
    count += 1
while count >= 0:
    b = num // (10 ** (count-1)) %10
    count -= 1
    print(int(b),end="")
    sum += b
print("和为：%d" %sum)